-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🧹 [cleanup] - refactoring to reduce cyclomatic complexity in machine controller, add missing autogenerated changes #174
Conversation
64f89b9
to
46e8990
Compare
46e8990
to
9a5dfbd
Compare
Created #175 to update GHA for diff checking (out of scope for this PR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only you 👈🐻 can prevent complexity! 🔥🔥
if linodeInstance == nil { | ||
err = errors.New("missing instance") | ||
|
||
logger.Error(err, "Panic! Failed to create isntance") | ||
|
||
return nil, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not totally sure that we can remove this check? I assume it double-checks this part:
cluster-api-provider-linode/controller/linodemachine_controller.go
Lines 246 to 251 in 9a5dfbd
listFilter := util.Filter{ | |
ID: machineScope.LinodeMachine.Spec.InstanceID, | |
Label: machineScope.LinodeMachine.Name, | |
Tags: tags, | |
} | |
linodeInstances, err := machineScope.LinodeClient.ListInstances(ctx, linodego.NewListOptions(1, listFilter.String())) |
But I suspect this issue might be related to a something we hit before with the Linode Firewall, where if you call the linodego.Client
with a bad(?) util.Filter
you can get a nil
object back with no error.
c9e04b2
to
f57fd37
Compare
f57fd37
to
8665371
Compare
64d5a23
to
470be5d
Compare
470be5d
to
aed813c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer: Based on #172 which was just focused on some lint changes
TODOs: